{%include file="index.header.tpl.php"%}
{%include file="index.left.tpl.php"%}
  <!--主要内容开始-->
  <div class="content-wrapper">
    <section class="content">
      <div class="row">
        <section class="col-lg-12 connectedSortable">
         <div class="box box-default box-solid">
             <form action="index.php" method="get">	
                <div class="box-header with-border">
                    <span class="fa fa-search" style="float:left; font-size:18px; padding-top:3px; color:#3c8dbc;" ></span>
                    <p class="box-title">自定义分数段查询</p>
                </div>
                <div class="box-body">
                         <div class="col-md-4 form-group log">
                              <label class="col-sm-5 control-label text-right">
                                   学期：
                              </label>
                              <div class="input-group col-sm-7 col-xs-12" >
                                      <select class="form-control" id="semester_id" name="semester_id">   
                                            <option value="0">-请选择-</option>  
											{%foreach from=$semester_lists key=key item=value%}
                                            <option value="{%$value.semester_id%}">{%$value.semester_name%}</option>
											{%/foreach%}
                                        </select> 
                              </div> 
                         </div>
                         <div class="col-md-4 form-group examine"> 
                              <label class="col-sm-5 control-label text-right">
                                   考试名称：
                              </label>
                              <div class="input-group col-sm-7 col-xs-12" >
                                      <select class="form-control" id="exam_name" name="exam_id">  
                                            <option value="0">-请选择-</option>  
                                        </select>  
                              </div> 
                         </div>
                       <div class="form-group">
                              <label class="col-sm-4 control-label text-right">
                                   年级：
                              </label>
                              <div class="input-group col-sm-3 col-xs-12">
                                     <select class="form-control" name="grade_id">
											{%foreach from=$grade_lists key=key item=value%}
                                            <option value="{%$value.grade_id%}">{%$value.grade_name%}</option>
											{%/foreach%}
                                     </select>
                              </div> 
                      </div>
                      <div class="form-group">
						  <label for="inputPassword3" class="col-sm-4 col-xs-3 control-label text-right">
							   选择学科：
						  </label>
						  <div class="input-group col-sm-6 col-xs-9">
								{%foreach from=$subject_lists key=key item=value%}
							    <label class="choice"><input type="checkbox" name="subject_ids[]" value="{%$value.subject_id%}"> {%$value.subject_name%}</label>
								{%/foreach%}
						  </div>
				      </div>
                      <div class="form-group">
						  <label for="inputPassword3" class="col-sm-4 col-xs-3 control-label text-right">
							   选择分数段：
						  </label>
						  <div class="input-group col-sm-6 col-xs-9">
							    <table class="table" id="plus" style="width:280px;">
                                       <tr>
                                            <td>选择</td>
                                            <td>最高分</td>
                                            <td>最低分</td>
                                       </tr>
                                </table>
                                <input type="button" name="xx" onclick="addNewRow();" value="添加分数段" />
                                <input type="button" name="yy" onclick="removeRow();" value="删除分数段" />
						  </div>
				      </div>
				</div><!--box-body -->
                <div class="box-footer text-center">
					  <input type="hidden" name="a" value="score.diy">	
                      <button type="submit" class="btn btn-primary">确 定</button>
                </div>
               </form>
              </div><!--box box-default box-solid-->
          </section>   
         </div><!--row-->
      </section>
   </div>
  <!--主要内容结束-->
{%include file="index.footer.tpl.php"%}
 <!--二级联动-->
  <script type="text/javascript">
        $(document).ready(function () {
             $("#semester_id").change(function () {		
                 if ($(this).val() == "-1") {
					$("#industr").remove(); return; 
					}
                else {
			var timestamp = new Date().getTime();
			$.ajax({
			url:"index.php?a=exam.listBySemesterJson",
			type:"get",
			data: "semester_id=" + $("#semester_id").find("option:selected").val() + "&timestamp=" + timestamp,
			dataType:"json",
			success:function(msg){
                             var industr = "";
                             $.each(msg, function (n, v) {
                                industr += ("<option value=\"" + n + "\">" + v);
                                industr += ("</option>");
                            });
                             $("#exam_name").html(industr);			   			   
			}
			});					
                 }

            });

        });
</script>
    <script language="javascript">
 //窗口表格增加一行
  function addNewRow(){
   var tabObj=document.getElementById("plus");//获取添加数据的表格
   var rowsNum = tabObj.rows.length;  //获取当前行数
   var colsNum=tabObj.rows[rowsNum-1].cells.length;//获取行的列数
   var myNewRow = tabObj.insertRow(rowsNum);//插入新行
   var newTdObj1=myNewRow.insertCell(0);
   newTdObj1.innerHTML="<input type='checkbox' name='chkArr' id='chkArr"+rowsNum+"' style='width:20px' />";
   var newTdObj2=myNewRow.insertCell(1);
   newTdObj2.innerHTML="<input type='text' name='range_max_"+rowsNum+"' id='nodeper"+rowsNum+"' style='width:50px' />";
   var newTdObj3=myNewRow.insertCell(2);
   newTdObj3.innerHTML="<input type='text' name='range_min_"+rowsNum+"' id='nodename"+rowsNum+"' style='width:50px' />";
  }
//窗口表格删除一行
  function removeRow(){
   var chkObj=document.getElementsByName("chkArr");
   var tabObj=document.getElementById("plus");
   for(var k=0;k<chkObj.length;k++){
    if(chkObj[k].checked){
     tabObj.deleteRow(k+1);
     k=-1;
    }
   }
  }
</script>

